package com.masz.seatatwo.controller;

import com.masz.seatatwo.dao.mapper.TbSeata;
import com.masz.seatatwo.service.SeataTwoTccService;
import com.masz.seatatwo.service.SeataTwoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author masz
 * @Date 2022/2/12 14:11
 */
@RestController
@RequestMapping("/seata")
public class SeataTwoController {

    @Value("${server.port}")
    private String port;

    @Autowired
    SeataTwoService seataOneService;

    @Autowired
    SeataTwoTccService tccService;

    @PostMapping("/test")
    public String test(@RequestBody TbSeata s){
        seataOneService.test(s.getV());
        return "seata-two-test:"+port;
    }

    @PostMapping("/tcc")
    public String tcc(@RequestBody TbSeata s){
        tccService.tcc(null);
        return "seata-two-tcc:"+port;
    }




}
